let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  addvideo:function(){
       wx.navigateTo({
         url: '/business-service/pages/staff_addVideo/index',
       })
  },
  jumpnav:function(e){
    var data = e.currentTarget.dataset;
    var url = e.currentTarget.dataset.url;
    url +=  "?id="+data.id
    wx.navigateTo({
      url: url,
    })
  },
  get_data(){
    var that=this
    wx.request({
      url: app.globalData.siteroot,
      data: {
        do:'Video_busVideoList',
        type:1,
        status:1,
        page:1,
        num:10,
        staff_id:wx.getStorageSync('staff_bind_id'),
        busid:wx.getStorageSync('staff_bind_id'),
      },
      success: function(res) {
        that.setData({
          listArr:res.data.info
        })
      }
    })
  },
  delvideo:function(e){
    var vid=e.currentTarget.dataset.id
    var that=this
        wx.showModal({
          title: '提示',
          content: '确定要删除该视频吗？',
          showCancel: true,
          cancelText:"取消",
          confirmText:"确定",
          confirmColor: '#ff4040',
          success: function (res) {
            if (res.cancel) {
           } else{
            wx.request({
              url: app.globalData.siteroot,
              data: {
                do:'Video_busDelVideo',
                staff_id:wx.getStorageSync('staff_bind_id'),
                userid:wx.getStorageSync('user_id'),
                vid:vid
              },
              success: function(res) {
                that.get_data()
              }
            })
            wx.showToast({
              title: '删除成功！',
              icon: 'none',
              duration: 1500
            })
           }
           },
           fail: function (res) { },
           complete: function (res) { }
      })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.get_data()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})